import {
  request
} from "@/utils/request";
import {
  getCurrentOrganizationId
} from '@/utils/util.js'
const api = {
  removeReviewLinkObj:"/project/Windchill/servlet/rest/hzero/pmgt/review/removeReviewLinkObj",//项目评审的删除接口
  reviewLinkObj:"/project/Windchill/servlet/rest/hzero/pmgt/review/reviewLinkObj",  //项目评审的粘贴接口
  getReviewList: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviews",
  getCheckUser: "/project/Windchill/servlet/rest/hzero/pmgt/team/getDataProjectTeam",
  getProcessType: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewTypes",
  getReviewPoint: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewPoint",
  // getBasicMessage: ,
  getDefaultDeliverable: "/project/Windchill/servlet/rest/hzero/pmgt/review/getDefaultDeliverable",
  getProcessPeople: "/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getReviewSelectPrincipal",
  getRelationRisks: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewRelatedRisks",
  getRelationQuestions: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewRelatedIssues",
  getRelaDeliverables: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewDeliverables",
  getReviewKey: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewSelfChecks",
  getReviewDetails: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewBaseAttrs",
  reviewSelfChecks: "/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewSelfChecks",
  saveSelfChecks: "/project/Windchill/servlet/rest/hzero/pmgt/review/saveSelfchecksResult",
  saveDeliverable: "/project/Windchill/servlet/rest/hzero/pmgt/review/addDeliverable",
  saveReview: "/project/Windchill/servlet/rest/hzero/pmgt/review/createPIReview",
  editProcessSet: "/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getWFSelectPrincipal",
  removeDeliverable: "/project/Windchill/servlet/rest/hzero/pmgt/review/removeDeliverable",
  urgeFlyBook: "/project/Windchill/servlet/rest/hzero/pmgt/review/reviewUrgeToDo",
  creatorMake: "/workflow/Windchill/servlet/rest/hzero/foundation/workflow/completeRunningWorkItemBySelf",
  systemSearch: "/project/Windchill/servlet/rest/hzero/pdm/core/selectObjsFromPIProject",
  refreshDeliverable: "/project/Windchill/servlet/rest/hzero/pmgt/review/refreshDeliverable",
  deleteReview: "/project/Windchill/servlet/rest/hzero/pdm/core/deleteObjForAllVersion",
  downloadTaskBook: "/project/Windchill/servlet/rest/hzero/pmgt/taskbook/downloadTaskBookFile",
  uploadPlanning: "/project/Windchill/servlet/rest/hzero/pmgt/review/addTaskBookAsDelivers",
  checkDeliverAccess: "/project/Windchill/servlet/rest/hzero/pmgt/project/checkDeliverAccess",
  savesDeliverable: "/project/Windchill/servlet/rest/hzero/pmgt/review/saveDeliverables"
}
// 删除评审里的问题、风险的接口
export function removeReviewLinkObj(parameter) {
  return request({
    url: api.removeReviewLinkObj,
    method: "post",
    data: parameter,
  });
}
// 评审里问题、风险粘贴的接口
export function reviewLinkObj(parameter) {
  return request({
    url: api.reviewLinkObj,
    method: "post",
    data: parameter,
  });
}
// 获取评审列表
export function getReviewList(parameter) {
  return request({
    url: api.getReviewList,
    method: "post",
    data: parameter,
  });
}
// 获取自检人
export function getCheckUser(parameter) {
  return request({
    url: api.getCheckUser,
    method: "post",
    data: parameter,
  });
}
// 获取流程类型
export function getProcessType(parameter) {
  return request({
    url: api.getProcessType,
    method: "post",
    data: parameter,
  });
}
// 获取评审点
export function getReviewPoint(parameter) {
  return request({
    url: api.getReviewPoint,
    method: "post",
    data: parameter,
  });
}
//获取基本信息
export function getBasicMessage(parameter) {
  return request({
    url: `/project/Windchill/servlet/rest/hzero/pmgt/review/getReviewAttrs?reviewConfKey=${parameter.reviewConfKey}&reviewType=${parameter.reviewType}`,
    method: "post",
    data: parameter,
  });
}
//获取默认交付物
export function getDefaultDeliverable(parameter) {
  return request({
    url: api.getDefaultDeliverable,
    method: "post",
    data: parameter,
  });
}
//获取流程选人
export function getProcessPeople(parameter) {
  return request({
    url: api.getProcessPeople,
    method: "post",
    data: parameter,
  });
}
//获取评审关联风险
export function getRelationRisks(parameter) {
  return request({
    url: api.getRelationRisks,
    method: "post",
    data: parameter,
  });
}
// 获取评审关联问题
export function getRelationQuestions(parameter) {
  return request({
    url: api.getRelationQuestions,
    method: "post",
    data: parameter,
  });
}
// 获取评审关联的交付物
export function getRelaDeliverables(parameter) {
  return request({
    url: api.getRelaDeliverables,
    method: "post",
    data: parameter,
  });
}
// 获取评审自检要素
export function getReviewKey(parameter) {
  return request({
    url: api.getReviewKey,
    method: "post",
    data: parameter,
  });
}
//获取评审会议纪要
export function getMeetingMessage(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/meeting-summarys/${parameter.oid}`,
    method: 'get',
  })
}
// 创建评审纪要
export function createMeetingMessage(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/meeting-summarys`,
    method: 'post',
    data: parameter,
  })
}
// 修改评审纪要
export function editMeetingMessage(parameter) {
  return request({
    url: `/project/v1/${getCurrentOrganizationId()}/meeting-summarys`,
    method: 'put',
    data: parameter,
  })
}
// 获取流程
export function getReviewDetails(parameter) {
  return request({
    url: api.getReviewDetails,
    method: "post",
    data: parameter,
  });
}
// 获取评审的自检要素
export function reviewSelfChecks(parameter) {
  return request({
    url: api.reviewSelfChecks,
    method: "post",
    data: parameter,
  });
}
//保存自检结果
export function saveSelfChecks(parameter){
  return request({
    url: api.saveSelfChecks,
    method: "post",
    data: parameter,
  });
}
//保存交付物
export function saveDeliverable(parameter) {
  return request({
    url: api.saveDeliverable,
    method: "post",
    data: parameter,
  });
}
//移除交付物
export function removeDeliverable(parameter) {
  return request({
    url: api.removeDeliverable,
    method: "post",
    data: parameter,
  });
}
//保存评审
export function createReview(parameter) {
  return request({
    url: api.saveReview,
    method: "post",
    data: parameter,
  });
}
// 编辑流程设置
export function editProcessSet(parameter) {
  return request({
    url: api.editProcessSet,
    method: "post",
    data: parameter,
  });
}
// 飞书催一下
export function urgeFlyBook(parameter) {
  return request({
    url: api.urgeFlyBook,
    method: "post",
    data: parameter,
  });
}
// 起草人身份操作
export function creatorMake(parameter) {
  return request({
    url: api.creatorMake,
    method: "post",
    data: parameter,
  });
}
// 系统搜索
export function systemSearch(parameter) {
  return request({
    url: api.systemSearch,
    method: "post",
    data: parameter,
  });
}
// 刷新交付物
export function refreshDeliverable(parameter) {
  return request({
    url: api.refreshDeliverable,
    method: "post",
    data: parameter,
  });
}
// 删除评审
export function deleteReview(parameter) {
  return request({
    url: api.deleteReview,
    method: "post",
    data: parameter,
  });
}
// 下载任务书
export function downloadTaskBook(parameter) {
  return request({
    url: api.downloadTaskBook,
    method: "post",
    data: parameter,
  });
}
// 上传任务书
export function uploadPlanning(parameter) {
  return request({
    url: api.uploadPlanning,
    method: "post",
    data: parameter,
  });
}
//校验是否流程中交付物可新增和删除
export function checkDeliverAccess(parameter) {
  return request({
    url: api.checkDeliverAccess,
    method: "post",
    data: parameter,
  });
}
export function savesDeliverable(parameter) {
  return request({
    url: api.savesDeliverable,
    method: "post",
    data: parameter,
  });
}